package com.human.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.human.entity.Emp;
import com.human.entity.ResultVo;
import com.human.service.IPasswordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author jzq
 * @date 2023/3/9 10:55
 */
@SuppressWarnings({"all"})
@RestController
@RequestMapping("/api/password")
@Api(tags = "找回密码")
@ApiSupport(order = 8)
public class PasswordController {

    @Autowired
    IPasswordService passwordService;


    @PostMapping("/sendCode")
    @ApiOperation(value = "发送验证码")
    public ResultVo sendCode(String email) {
        return passwordService.sendCode(email);
    }

    @PostMapping("/validateCode")
    @ApiOperation(value = "判断验证码是否正确")
    public ResultVo validateCode(@RequestBody Emp emp) {
        return passwordService.validateCode(emp);
    }

    @PutMapping("/updatePwd")
    @ApiOperation(value = "修改密码")
    public ResultVo updatePwd(@RequestBody Emp emp) {
        return passwordService.updatePwd(emp);
    }

}
